package com.base.dataStructure.recurrence;

/**
 * @Author: hdhao
 * @Create: 2023/3/29 - 19:16
 * @Version: v1.0
 */
//递归求和
public class Sum {
    public static void main(String[] args) {
        long sum = sum(100);
        System.out.println(sum);
    }

    public static long sum(int n){
        if (n == 1){
            return 1;
        }
        return sum(n-1)+n;
    }
}
